#pragma once
#include <string>

namespace ngintoy
{
    namespace utils
    {
        enum class journal_kind
        {
            info, warn, error,
            begin, end,
        };

        struct journal final
        {
            using self = journal;

            journal(journal_kind kind, std::string text="journal");

            static self info (std::string text=" info") { return { journal_kind::info , std::move(text) }; }
            static self warn (std::string text=" warn") { return { journal_kind::warn , std::move(text) }; }
            static self error(std::string text="error") { return { journal_kind::error, std::move(text) }; }
            static self begin(std::string text="begin") { return { journal_kind::begin, std::move(text) }; }
            static self end  (std::string text=" end ") { return { journal_kind::end  , std::move(text) }; }

            self & writeline(std::string const& line);

        private:
            journal_kind kind;
            std::string kind_text;
        };

        inline journal & operator << (journal & j, std::string const& line)
        {
            return j.writeline(line);
        }

        inline journal & operator << (journal const& j, std::string const& line)
        {
            return const_cast<journal&>(j) << line;
        }
    }
}

